package hczc.longcai.com.hccrowdfunding.home.fourth_mine.adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import hczc.longcai.com.hccrowdfunding.R;
import hczc.longcai.com.hccrowdfunding.application.BaseApplication;
import hczc.longcai.com.hccrowdfunding.home.fourth_mine.beans.AddIncome;

/**
 * Created by Administrator on 2016/1/27.
 */
public class AddIncomeAdapter extends BaseAdapter {

    private Context context;
    private List<AddIncome> list;

    public AddIncomeAdapter(Context context, List<AddIncome> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if(convertView == null){
            holder = new ViewHolder();
            convertView = LayoutInflater.from(context).inflate(R.layout.item_add_income,null);
            BaseApplication.scaleScreenHelper.loadView(((ViewGroup) convertView));
            holder.name = ((TextView) convertView.findViewById(R.id.add_income_name));
            holder.money = ((TextView) convertView.findViewById(R.id.add_income_text));
            convertView.setTag(holder);
        }

        holder = (ViewHolder) convertView.getTag();
        holder.name.setText(list.get(position).getName());
        holder.money.setText(list.get(position).getMoney());

        return convertView;
    }

    class ViewHolder{
        TextView name,money;


    }
}
